import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { UserLevelVO, UserLevelForm, UserLevelQuery } from '@/api/system/userLevel/types';

/**
 * 查询等级管理列表
 * @param query
 * @returns {*}
 */

export const listUserLevel = (query?: UserLevelQuery): AxiosPromise<UserLevelVO[]> => {
  return request({
    url: '/system/userLevel/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询等级管理详细
 * @param id
 */
export const getUserLevel = (id: string | number): AxiosPromise<UserLevelVO> => {
  return request({
    url: '/system/userLevel/' + id,
    method: 'get'
  });
};

/**
 * 新增等级管理
 * @param data
 */
export const addUserLevel = (data: UserLevelForm) => {
  return request({
    url: '/system/userLevel',
    method: 'post',
    data: data
  });
};

/**
 * 修改等级管理
 * @param data
 */
export const updateUserLevel = (data: UserLevelForm) => {
  return request({
    url: '/system/userLevel',
    method: 'put',
    data: data
  });
};

/**
 * 删除等级管理
 * @param id
 */
export const delUserLevel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/userLevel/' + id,
    method: 'delete'
  });
};
